package vn.edu.hut.soict.translate.database.tool;

import java.util.List;

import vn.edu.hut.soict.translate.database.TranslatorDatabase;
import vn.edu.hut.soict.translate.wordgraph.Word;
import vn.edu.hut.soict.translate.wordgraph.WordUtils;

public class DatabaseStatistic {

	public void statistic() {
		TranslatorDatabase database = new TranslatorDatabase();
		database.connect();
		List<String> sentences = database.getAllVietnameseSentences();

		int sentenceCount = sentences.size();
		int wordCount = 0;

		for (String sentence : sentences) {
			Word[] words = WordUtils.split(sentence);
			wordCount += words.length;
		}

		System.out.println("Sentence count: " + sentenceCount);
		System.out.println("Word count: " + wordCount);
		System.out.println("Average sentence length: " + ((double) wordCount) / sentenceCount);
	}

	public static void main(String[] args) {
		(new DatabaseStatistic()).statistic();
	}
}
